home *** CD-ROM | disk | FTP | other *** search
- //
- // antflvlink.js
- // firefox
- //
- // Created by Zak on 2008-06-12.
- // Copyright 2008-2009 Ant.com. All rights reserved.
- //
-
- /**
- * Contains values necessary to list and download a flv
- * @param origin Where the flv came from
- * @param url Link to the flv
- * @param name Guessed name of the movie
- * @param header option header object for request the url
- */
- var AntFlvLink = function (obj)
- {
- this.origin = obj.origin;
- this.url = obj.url;
- this.name = obj.name;
- this.doc = obj.doc;
- this.path = obj.path ? obj.path : "";
- this.date = obj.date ? obj.date : "";
- this.filesize = obj.filesize ? obj.filesize : "";
- this.contentType = obj.type ? obj.type : "";
- this.contentLength = obj.length ? obj.length : "";
- this.contentCharset = obj.charset ? obj.charset : "";
- this.size = obj.size ? parseInt(obj.size) : -1;
-
- if (this.size < 0)
- this.sizeh = '';
- else
- {
- var a = AntLib.convertByteUnits(this.size);
- this.sizeh = a[0] + ' ' + a[1];
- }
-
- this.score = obj.score ? obj.score : 0;
-
- if (obj.header)//optional parameter
- this.header = obj.header;
- else
- this.header = '';
- };
-
-
- AntFlvLink.prototype =
- {
- /**
- * incrementFlvName ... transform name -> name2, name2 -> name3 ...
- * @param flvLink
- */
- incrementFlvName: function ()
- {
- var match = this.name.match("_([0-9]+)$");
-
- if (match && match.length > 1)
- {
- var inc = parseInt(match[1], 10) + 1;
-
- this.name = this.name.substring(0, this.name.length - match[1].length) + inc;
- }
- else
- this.name += "_1";
- },
- };
-